//
//  SRUserInfoTableViewCell.m
//  StoryShow
//
//  Created by CyonLeuMBP on 2017/4/25.
//  Copyright © 2017年 qudiandu.cn. All rights reserved.
//

#import "SRUserInfoTableViewCell.h"
#import "SRPersonalCenterConstant.h"

NSString *const kSRUserInfoTableViewCell = @"SRUserInfoTableViewCell";

@implementation SRUserInfoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    FZStyleSheet *css = [FZStyleSheet currentStyleSheet];
    
    self.backgroundColor = self.contentView.backgroundColor = [UIColor clearColor];
    self.borderContentView.backgroundColor = css.color_5;
    self.borderContentView.layer.masksToBounds = YES;
    self.borderContentView.layer.cornerRadius = 5;
    
    self.avatarImageView.iconStyle = FZIconImageViewStyleCircle;
    self.avatarImageView.borderWidth = 0;
    
    self.preTitleLabel.textColor = css.color_6;
    self.subtitleLabel.textColor = css.color_7;
    
    self.preTitleLabel.font = css.fontOfH5;
    self.subtitleLabel.font = css.fontOfH5;
    
//    self.selectedBackgroundView = [[UIView alloc] init];
//    self.selectedBackgroundView.backgroundColor = css.color_2;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setAvatarShown:(BOOL)avatarShown {
    _avatarShown = avatarShown;
    
    self.avatarImageView.hidden = !avatarShown;
    self.subtitleLabel.hidden = avatarShown;
}

- (void)updateCellInfo:(FZUserSettingModel *)data {
    self.preTitleLabel.text = data.title;
    
    if ([data.identifier isEqualToString:userinfo_avatar]) {
        self.avatarShown = YES;
        [self.avatarImageView fz_setImageWithAvatarDefaultPlaceholderWithURL:[NSURL URLWithString:data.iconName] placeholderSize:CGSizeZero];
        
    } else {
        self.avatarShown = NO;
        self.subtitleLabel.text = data.subtitle;
    }
    
}

- (void)setIconImage:(UIImage *)image {
    [self.avatarImageView setImage:image];
}

@end
